<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>显示列表项的内容</title>
</head>
<body>
    <h3>显示列表项的内容</h3>
    <select id="bookList" size="5" onchange="displayItem()">
        <option value="35">计算机组成原理</option>
        <option value="38">数据结构</option>
        <option value="43">计算机网络</option>
        <option value="40">Java程序设计</option>
        <option value="28">算法分析</option>
    </select>

    <script>
        function displayItem() {
            const selectElement = document.getElementById("bookList");
            const selectedOption = selectElement.options[selectElement.selectedIndex];
            const bookName = selectedOption.text;
            const bookPrice = selectedOption.value;

            alert(`教材名称: ${bookName}\n定价: ${bookPrice}元`);
        }
    </script>
</body>
</html>